#include <stdio.h>
#include <stdlib.h>

typedef struct node
{
    int data;
    struct node* next;
}LNode;
void SlistPushback(LNode**phead,int x)
{
    LNode* Tail=*phead;
    LNode* newnode;
    newnode=(LNode*)malloc(sizeof(LNode));
    newnode->data=x;
    newnode->next=NULL;
    if(*phead==NULL)
    {
        *phead=newnode;

    }
    else
    {
    while(Tail->next!=NULL)
    {
        Tail=Tail->next;
    }
    Tail->next=newnode;
    }
}
LNode* SListfind(LNode *head,int y,int *p)
{
    LNode *cur=head;
    int s=1;
    while(cur!=NULL)
    {
        if(cur->data==y)
        {
            *p=s;
            return cur;
        }
        cur=cur->next;
        s++;
    }
    return NULL;
}
int main()
{
    int n,x,p,y;
    while(scanf("%d",&n)!=EOF)
    {
          LNode* plist;
          plist=NULL;
        for(int i=0;i<n;i++)
        {
            scanf("%d",&x);
            SlistPushback(&plist,x);
        }
        scanf("%d",&y);
        LNode* find=SListfind(plist,y,&p);
        if(find==NULL)
        {
            printf("%d\n",0);
        }
        else
        {
            printf("%d %d",p,find->data);
        }
    }
    return 0;
}
